package com.xja.controller;

import com.xja.common.JsonBean;
import com.xja.entity.SysDept;
import com.xja.service.SysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author CHENCHEN
 * @company 北京学佳澳教育科技
 * @create 2024-01-15 9:49
 */
@RestController
@RequestMapping("sysDept")
public class SysDeptController {

    @Autowired
    private SysDeptService sysDeptService;

    @GetMapping("getTreeList")
    public JsonBean getTreeList(){

        return sysDeptService.getTreeList();
    }

    @GetMapping("getTableList")
    public JsonBean getTableList(){

        return sysDeptService.getTreeList();
    }

    @GetMapping("selectById")
    public JsonBean selectById(Integer id){

        return sysDeptService.selectById(id);
    }

    @GetMapping("deleteById")
    public JsonBean deleteById(Integer id){

        return sysDeptService.deleteById(id);
    }

    @PostMapping("insertDept")
    public JsonBean insertDept(SysDept sysDept){

        return sysDeptService.insertDept(sysDept);
    }

    @PostMapping("updateDept")
    public JsonBean updateDept(SysDept sysDept){

        return sysDeptService.updateDept(sysDept);
    }
}
